/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package appMhs;

/**
 *
 * @author vebry3
 */

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class connect {
    
    private static Connection connect;
    public static Connection getConnection(){
        
        if(connect == null){
            
            try{
                String url ="jdbc:mysql://localhost:3306/universitas";
                String user ="root";
                String password = "1234";
                
                DriverManager.registerDriver(new com.mysql.jdbc.Driver());
                connect = DriverManager.getConnection(url, user, password);
                
            } catch (SQLException t){
                System.out.println("Error membuat koneksi.");
            }
        }
        return connect;
    }
}
    
